const { STRING, INTEGER } = require("sequelize")
const seq = require("./seq")

// 定义模型
const Item = seq.define("Item", {
  categoryId: {
    type: INTEGER,
    allowNull: false,
    comment: "类别id"
  },
  name: {
    type: STRING,
    allowNull: false,
    comment: "商品名称"
  },
  price: {
    type: INTEGER,
    allowNull: false,
    comment: "价格，保留两位小数"
  },
  cover: {
    type: STRING(500),
    allowNull: false,
    comment: "封面图片"
  },
  description: {
    type: STRING(2000),
    comment: "简介"
  }
}, {
  timestamps: false,
  underscored: true
})

// 发布模型
module.exports = Item
